package org.opens.util;

import java.util.HashMap;
import java.util.Objects;

public class R extends HashMap<String, Object> {

    private static final long serialVersionUID = 151641579L;

    public R() {
    }

    public static R warning(String message) {
        return Objects.requireNonNull(getInstance("201", message));
    }

    public static R success(String message) {
        return Objects.requireNonNull(getInstance("200", message));
    }

    public static R error(String message) {
        return Objects.requireNonNull(getInstance("300", message));
    }

    public static R getInstance(String code, String message) {
        R r = new R();
        r.put("code", code);
        r.put("message", message);
        return Objects.requireNonNull(r);
    }

    public static void success() {
    }
}